﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace AChance.Func
{
    public static class FunContext
    {
        /// <summary>
        /// 判断系统是否启动成功
        /// </summary>
        public static bool IsStartSuccess { get; set; } = false;
        public static string CurrentPath { get; } = Environment.CurrentDirectory + "\\";
        /// <summary>
        /// 机构编号
        /// </summary>
        public static string OrganNo { get; set; } = string.Empty;
        public static FunVar.AppSettings AppSettings { get; } = new FunVar.AppSettings();
        public static class Services
        {
            private static IServiceProvider _services;
            public static void Init(IServiceProvider services)
            {
                _services = services;
            }
            public static IHttpClientFactory GetHttpClientFactory()
            {
                return _services.GetRequiredService<IHttpClientFactory>();
            }
        }
    }
}
